﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using JobSiteStarterKit.DAL;
using JobSiteStarterKit.BOL;

/// <summary>
/// Summary description for Jobseeker
/// </summary>
public class Jobseeker
{
    public struct jobseekerdata
    {
    public string JobSeekerName;
    public string JobSeekerUserName;
    public string JobSeekerMoney;
    public string JobSeekerEmail;
    public string JobSeekerAddress;
    public int JobSeekerCountry;
    public int JobSeekerState;
    public string JobSeekerCity;
    public string JobSeekerMobile;
    public string JobSeekerPhone;
    public int JobSeekerTotalExpYear;
    public int JobSeekerTotalExpMonth;
    public int  JobSeekerAnnualSalaryLakh;
    public int  JobSeekerAnnualSalaryMonth;
    public int JobSeekerFunctionalArea;
    public int JobSeekerIndustry;
    public string JobSeekerKeySkills;
    public string JobSeekerResumeHeadlines;
    public int JobSeekerEducationLevelID;
    public string JobSeekerEducationOthers;
    public string JobSeekerlocationOthers;       //
    public string JobseekerfuntionOthers;
    public string JobseekerIndustryOthers;
    public string jobseekerpassword;
    }
	public Jobseeker()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public bool savejobseeker(jobseekerdata objjobseeker)
    {
        
            int i;
            //Membership.CreateUser(objjobseeker.JobSeekerUserName, objjobseeker.jobseekerpassword, objjobseeker.JobSeekerEmail);
            //Roles.AddUserToRole(objjobseeker.JobSeekerUserName, System.Web.Configuration.WebConfigurationManager.AppSettings["jobseekerrolename"]);
            DBAccess objDb = new DBAccess();
            SqlParameterCollection obj = (SqlParameterCollection)objDb.Parameters;

            obj.Add("@JobSeekerName", SqlDbType.NVarChar, 500).Value = objjobseeker.JobSeekerName;
            obj.Add("@JobSeekerUserName", SqlDbType.NVarChar, 200).Value = objjobseeker.JobSeekerUserName;
            obj.Add("@JobSeekerMoney", SqlDbType.NVarChar, 20).Value = objjobseeker.JobSeekerMoney;
            obj.Add("@JobSeekerEmail", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerEmail;
            obj.Add("@JobSeekerAddress", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerAddress;
            obj.Add("@JobSeekerCountry", SqlDbType.Int).Value = objjobseeker.JobSeekerCountry;
            obj.Add("@JobSeekerState", SqlDbType.Int).Value = objjobseeker.JobSeekerState;
            obj.Add("@JobSeekerCity", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerCity;
            obj.Add("@JobSeekerMobile", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerMobile;
            obj.Add("@JobSeekerPhone", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerPhone;
            obj.Add("@JobSeekerTotalExpYear", SqlDbType.Int).Value = objjobseeker.JobSeekerTotalExpYear;
            obj.Add("@JobSeekerTotalExpMonth", SqlDbType.Int).Value = objjobseeker.JobSeekerTotalExpMonth;
            obj.Add("@JobSeekerAnnualSalaryLakh", SqlDbType.Money).Value = objjobseeker.JobSeekerAnnualSalaryLakh;
            obj.Add("@JobSeekerAnnualSalaryMonth", SqlDbType.Money).Value = objjobseeker.JobSeekerAnnualSalaryMonth;
            obj.Add("@JobSeekerFunctionalArea", SqlDbType.Int).Value = objjobseeker.JobSeekerFunctionalArea;
            obj.Add("@JobSeekerIndustry", SqlDbType.Int).Value = objjobseeker.JobSeekerIndustry;
            obj.Add("@JobSeekerKeySkills", SqlDbType.NVarChar, 2000).Value = objjobseeker.JobSeekerKeySkills;
            obj.Add("@JobSeekerResumeHeadlines", SqlDbType.NVarChar, 300).Value = objjobseeker.JobSeekerResumeHeadlines;
            obj.Add("@EducationLevelID", SqlDbType.Int).Value = objjobseeker.JobSeekerEducationLevelID;
            obj.Add("@JobSeekerEducationOthers", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerEducationOthers;
            obj.Add("@JobSeekersLocationothers", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerlocationOthers;
            obj.Add("@JobseekersfuntionalOthers", SqlDbType.NVarChar, 200).Value = objjobseeker.JobseekerfuntionOthers;
            obj.Add("@JobseekersIndustryOthers", SqlDbType.NVarChar, 200).Value = objjobseeker.JobseekerIndustryOthers;

            i = (int)objDb.ExecuteNonQuery("JobsDb_Jobseeker_insert");
            if (i > 0)
            {
                return true;

            }
            else
            {
                return false;
            }
        }
       
        
    

    public bool Editjobseeker(jobseekerdata objjobseeker)
    {
        int i;
        //Membership.CreateUser(objjobseeker.JobSeekerUserName, objjobseeker.jobseekerpassword, objjobseeker.JobSeekerEmail);
        //Roles.AddUserToRole(objjobseeker.JobSeekerUserName, System.Web.Configuration.WebConfigurationManager.AppSettings["jobseekerrolename"]);
        DBAccess objDb = new DBAccess();
        SqlParameterCollection obj = (SqlParameterCollection)objDb.Parameters;

        obj.Add("@JobSeekerName", SqlDbType.NVarChar, 500).Value = objjobseeker.JobSeekerName;
        obj.Add("@JobSeekerUserName", SqlDbType.NVarChar, 200).Value = objjobseeker.JobSeekerUserName;
        obj.Add("@JobSeekerMoney", SqlDbType.NVarChar, 20).Value = objjobseeker.JobSeekerMoney;
        //obj.Add("@JobSeekerEmail", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerEmail;
        obj.Add("@JobSeekerAddress", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerAddress;
        obj.Add("@JobSeekerCountry", SqlDbType.Int).Value = objjobseeker.JobSeekerCountry;
        obj.Add("@JobSeekerState", SqlDbType.Int).Value = objjobseeker.JobSeekerState;
        obj.Add("@JobSeekerCity", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerCity;
        obj.Add("@JobSeekerMobile", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerMobile;
        obj.Add("@JobSeekerPhone", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerPhone;
        obj.Add("@JobSeekerTotalExpYear", SqlDbType.Int).Value = objjobseeker.JobSeekerTotalExpYear;
        obj.Add("@JobSeekerTotalExpMonth", SqlDbType.Int).Value = objjobseeker.JobSeekerTotalExpMonth;
        obj.Add("@JobSeekerAnnualSalaryLakh", SqlDbType.Money).Value = objjobseeker.JobSeekerAnnualSalaryLakh;
        obj.Add("@JobSeekerAnnualSalaryMonth", SqlDbType.Money).Value = objjobseeker.JobSeekerAnnualSalaryMonth;
        obj.Add("@JobSeekerFunctionalArea", SqlDbType.Int).Value = objjobseeker.JobSeekerFunctionalArea;
        obj.Add("@JobSeekerIndustry", SqlDbType.Int).Value = objjobseeker.JobSeekerIndustry;
        obj.Add("@JobSeekerKeySkills", SqlDbType.NVarChar, 2000).Value = objjobseeker.JobSeekerKeySkills;
        obj.Add("@JobSeekerResumeHeadlines", SqlDbType.NVarChar, 300).Value = objjobseeker.JobSeekerResumeHeadlines;
        obj.Add("@EducationLevelID", SqlDbType.Int).Value = objjobseeker.JobSeekerEducationLevelID;
        obj.Add("@JobSeekerEducationOthers", SqlDbType.NVarChar, 50).Value = objjobseeker.JobSeekerEducationOthers;
        obj.Add("@JobSeekersLocationothers", SqlDbType.NVarChar, 100).Value = objjobseeker.JobSeekerlocationOthers;
        obj.Add("@JobseekersfuntionalOthers", SqlDbType.NVarChar, 200).Value = objjobseeker.JobseekerfuntionOthers;
        obj.Add("@JobseekersIndustryOthers", SqlDbType.NVarChar, 200).Value = objjobseeker.JobseekerIndustryOthers;

        i = (int)objDb.ExecuteNonQuery("spUpdKeyJobsDb_Jobseeker");
        if (i > 0)
        {
            return true;

        }
        else
        {
            return false;
        }
    }
}

	